package com.yixing.tech.common.convert;

import java.util.Optional;

public class DoubleToIntegerConverter implements Converter<Double, Integer> {

    @Override
    public Integer convert(Double source) {
        return Optional.ofNullable(source).map(Double::intValue).orElse(null);
    }

    @Override
    public Class<Double> getSourceType() {
        return Double.class;
    }

    @Override
    public Class<Integer> getTargetType() {
        return Integer.class;
    }

}
